package cn.wolfcode.shop.cloud.util;


import org.apache.commons.codec.digest.DigestUtils;

import java.util.UUID;

//用户密码加密
public class Md5Util {

    public static String encode(String password,String salt){
       String s = ""+salt.charAt(1)+password+salt.charAt(2)+salt.charAt(3);
        return DigestUtils.md5Hex(s);
    }

    public static void main(String[] args) {
        String salt = UUID.randomUUID().toString().replace("-", "").substring(0, 5);

        String encode = encode("123456", salt);//加密后的密码
        System.out.println(salt);
        System.out.println(encode);
    }
}
